//
//  CourseViewCellHeaderView.m
//  xpkc
//
//  Created by TopSageOSX on 15/1/29.
//  Copyright (c) 2015年 TopSage. All rights reserved.
//

#import "CourseViewCellHeaderView.h"

@implementation CourseViewCellHeaderView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatView];
    }
    return self;
}
- (void)creatView{
    self.backgroundColor = [UIColor whiteColor];
    CGFloat offsize = 0.04*SCREEN_WIDTH;
    
    self.courseIcon = [[UIImageView alloc]init];
    self.courseIcon.frame = CGRectMake(0, offsize/2, offsize*0, offsize*2);
    self.courseIcon.image = [UIImage imageNamed:@"abc.png"];
    [self addSubview:self.courseIcon];
    
    self.courseTitle = [[UILabel alloc]init];
    self.courseTitle.frame = CGRectMake(CGRectGetMaxX(self.courseIcon.frame)+offsize, 8, SCREEN_WIDTH - self.courseIcon.frame.size.width - 15 - 16, 15);
    self.courseTitle.font = FONT_SYS_S;
    self.courseTitle.textColor = [UIColor darkGrayColor];
    [self addSubview:self.courseTitle];
    
    UILabel *deadLineName = [[UILabel alloc]init];
    deadLineName.frame = CGRectMake(CGRectGetMaxX(self.courseIcon.frame)+offsize+140, self.frame.size.height/2.0, 100, 14);
    deadLineName.text = @"有效期至:";
    deadLineName.textColor = [UIColor lightGrayColor];
    deadLineName.font = FONT_SYS_XS;
    [self addSubview:deadLineName];
    
    UILabel *topTeacher = [[UILabel alloc]init];
    topTeacher.frame = CGRectMake(CGRectGetMaxX(self.courseIcon.frame)+offsize, self.frame.size.height/2.0, 100, 14);
    topTeacher.text = @"主讲老师:";
    topTeacher.textColor = [UIColor lightGrayColor];
    topTeacher.font = FONT_SYS_XS;
    [self addSubview:topTeacher];

    self.validTerm = [[UILabel alloc]init];
    self.validTerm.frame = CGRectMake(deadLineName.frame.origin.x+60, self.frame.size.height/2.0, 100, 14);
    self.validTerm.textColor = [UIColor lightGrayColor];
    self.validTerm.font = FONT_SYS_XS;
    self.validTerm.text = @"2015-04-01";
    [self addSubview:self.validTerm];
    
    self.teacher = [[UILabel alloc]init];
    self.teacher.frame = CGRectMake(topTeacher.frame.origin.x+60, self.frame.size.height/2.0, 100, 14);
    self.teacher.textColor = [UIColor lightGrayColor];
    self.teacher.font = FONT_SYS_XS;
    self.teacher.text = @"王霞";
    [self addSubview:self.teacher];
    
    
    self.openFlag = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-30, 28, 18, 18)];
    self.openFlag.image = [UIImage imageNamed:@"headerflag"];
    [self addSubview:self.openFlag];
}

@end
